package com.huluobo.a2111douyindemo.home.tabItem;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;

import com.huluobo.mvvm_base.mvvm.base.viewmodel.BaseViewModel;
import com.huluobo.mvvm_base.mvvm.bean.BannerBeanResult;
import com.huluobo.mvvm_base.mvvm.bean.LikeVideoBeanResult;
import com.huluobo.mvvm_base.mvvm.bean.VideoBeanResult;

/**
 * Created by LC on 2024/2/26.
 */
public class CommonViewModel extends BaseViewModel<CommonRepo> {
    MutableLiveData<VideoBeanResult> getVideoSuccess = new MutableLiveData<>();
    MutableLiveData<String> getVideoFailed = new MutableLiveData<>();
    MutableLiveData<BannerBeanResult> getBannerSuccess = new MutableLiveData<>();
    MutableLiveData<String> getBannerFailed = new MutableLiveData<>();

    MutableLiveData<LikeVideoBeanResult> likeSuccess = new MutableLiveData<>();

    MutableLiveData<String> likeFailed = new MutableLiveData<>();

    MutableLiveData<LikeVideoBeanResult> noLikeSuccess = new MutableLiveData<>();

    MutableLiveData<String> noLikeFailed = new MutableLiveData<>();

    public void getBanner() {
        repo.loadBanner(getBannerSuccess, getBannerFailed);
    }

    public void getVideoList(int currentPage, int pageSize) {
        repo.loadVideos(currentPage, pageSize, getVideoSuccess, getVideoFailed);
    }

    public void likeVideo(int videoId) {
        repo.likeVideo(videoId, likeSuccess, likeFailed);
    }

    public void noLikeVideo(int videoId) {
        repo.noLikeVideo(videoId, noLikeSuccess, noLikeFailed);
    }

    public CommonViewModel(@NonNull Application application) {
        super(application);
    }

    @Override
    protected CommonRepo createRepo() {
        return new CommonRepo();
    }
}
